{include file="public/header"}

<script type="text/javascript">
	function xianshi_and_yincang(tids) {
		document.getElementById(tids).style.display = "block";
	}
	function xianshi_and_yincang_s(tids) {
		document.getElementById(tids).style.display = "none";
	}
	function huodong_dq(iud) {
		var xiansid="huoq_"+iud;
		var ifhsd=document.getElementById(xiansid).style.display;
		if(ifhsd=="none"){
			for(var r=1;r<=100;r++) {
				var anniuid="huoq_"+r;
				if($("#"+anniuid).length>0){		
					$('#'+anniuid).hide();	
				}
			}
			$('#huoq_'+iud).show();
		}
	}
	function lingqu(iud,obj) {
        if($(obj).html()=='领取中') return;
         $(obj).html('领取中')
		$.ajax({
                type: "post",
                url: "{:url('User/getAward')}",
                data: {"hdid":iud},
               
                success: function (data) {
                	if(data==1){
                        alert("领取成功！");
                       $(obj).html('领取')
					 	window.location.href = "{:url('Show/activity')}";
                	}else{
                		alert(data);
                		$(obj).html('领取')
                	}
                    
                }
		});
		
	}
</script>

<main class="outline" id="container">
<div
	style="width: 998px; border: #CCCCCC solid 1px; margin: auto; min-height: 600px; margin-top: 10px; margin-bottom: 10px">
	<div
		style="width: 300px; min-height: 600px; background: #fefdfd; border-right: #ccc solid 1px; line-height: 30px; float: left">
		<div
			style="width: 300px; height: 50px; background: #e94335; text-align: center; line-height: 50px">
			<strong style="color: #FFFFFF; font-size: 18px">活动列表</strong>
		</div>
		{foreach $huodongxx as $couu=>$rr}
		<div style='width:280px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: keep-all; cursor: pointer; margin-top:10px; margin-left:10px; line-height:40px; border-bottom: 1px dotted #ccc;' onClick="huodong_dq({$rr.id});"><span class='number'>{$couu+1}</span> {$rr.hd_name}</div>
		{/foreach}
	</div>
	{foreach $huodongxx as $couu=>$rr}
	<div style="width: 690px; min-height: 600px; float: right; border-left: #CCCCCC solid 1px;{if condition='$couu eq 0'} display:block; {else /} display:none; {/if}" id="huoq_{$rr.id}">
		<div style='width: 690px; height: 50px; border-bottom: 1px dotted #ccc; line-height: 50px; text-align: center'>
			<strong style='color: #333; font-size: 16px'>活动名称：{$rr.hd_name}</strong>
		</div>
		<div style='width: 690px; border-bottom: 1px dotted #ccc; line-height: 30px; text-align: center'>
			活动说明：{$rr.smwz}</div>
		{foreach($rr.sur as $it)}
		{if(!empty($it.0))}	
		<div style='width: 690px; height: 50px; border-bottom: 1px dotted #ccc; line-height: 50px; text-align: center'>
			<strong style='color: #333; font-size: 13px'>领取条件【{if condition="$rr.tjzq eq 1"}昨日{/if}{if condition="$rr.tjzq eq 2"}上周{/if}{if condition="$rr.tjzq eq 3"}上月{/if}充值】：{$it.0}元</strong>|
			<strong style='color: #333; font-size: 13px'>领取条件【{if condition="$rr.tjzq eq 1"}昨日{/if}{if condition="$rr.tjzq eq 2"}上周{/if}{if condition="$rr.tjzq eq 3"}上月{/if}投注】：{$it.1}元</strong>|
			<strong style='color: #333; font-size: 13px'>领取金额：{$it.2}元</strong>
		</div>
		{/if}
		{/foreach}
		<div style='width: 690px; height: 50px; border-bottom: 1px dotted #ccc; line-height: 50px; text-align: center'>
			<strong style='color: #333; font-size: 13px'>每日领取次数：{$rr.lq_count}次</strong>
		</div>
		<div style='width: 690px; height: 50px; border-bottom: 1px dotted #ccc; line-height: 50px; text-align: center'>
			<button type='button' class='btn btn-radius btn-default btn-register' onClick="lingqu({$rr.id},this);" style='margin-left: 0px; width: 150px'>立即领取</button>
		</div>
	</div>
	{/foreach}
</div>
</main>

{include file="public/footer"}
